#include "ScopeGuard.hpp"

void foo()
{
    auto fp = fopen("/path/to/file", "w");
    ScopeGuard fp_guard([&fp]() { fclose(fp); });

    //write_to_file(fp);                     // 异常安全
}